package com.springcloudemo.ms.conf;

import com.alibaba.csp.sentinel.transport.util.WritableDataSourceRegistry;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author Yangdw
 * @date 2025-08-23
 * @description:
 */
@Configuration
public class NacosLinkSentinelConfig implements InitializingBean {

    @Override
    public void afterPropertiesSet() throws Exception {

    }


    @PostConstruct
    public void init() throws Exception{
        NacosWritableDataSource ds = new NacosWritableDataSource(
                "sentinel-nacos-persist-consumer-flow.json",
                "DEFAULT_GROUP",
                "localhost:8848",
                ""
        );
        WritableDataSourceRegistry.registerFlowDataSource(ds);
    }
}
